package com.fastjrun.db2doc;

import cn.smallbun.screw.core.process.ProcessConfig;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * @author cuiyingfeng
 */
@Configuration
@ConfigurationProperties(prefix = "fastjrun.db2doc")
@Data
public class Db2DocConfig {
    // sql和生成文件所在的目录
    String dataDir;

    String docType;

    String[] ignoreTableName;
    String[] ignorePrefix;
    String[] ignoreSuffix;

    @Bean
    ProcessConfig getProcessConfig() {

        return ProcessConfig.builder()
                // 根据名称指定表生成
                .designatedTableName(new ArrayList<>())
                // 根据表前缀生成
                .designatedTablePrefix(new ArrayList<>())
                // 根据表后缀生成
                .designatedTableSuffix(new ArrayList<>())
                // 忽略表名
                .ignoreTableName(Arrays.asList(ignoreTableName))
                // 忽略表前缀
                .ignoreTablePrefix(Arrays.asList(ignorePrefix))
                // 忽略表后缀
                .ignoreTableSuffix(Arrays.asList(ignoreSuffix))
                .build();
    }

}
